A system that detects an air-fuel ratio, an NOx concentration and the like of exhaust gas by using an exhaust gas sensor including a pair of electrodes disposed at both sides of a solid electrolyte is generally known. In order to ensure high detection precision in the system like this, it is important to control the temperature of the sensor element (the element temperature) of an exhaust gas sensor to an appropriate temperature. For example, Patent Literature 1 discloses the system that controls the temperature of the air-fuel ratio sensor disposed in the exhaust channel of an internal combustion engine in accordance with the impedance of a solid electrolyte.